home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / semop.man < prev    next >
Encoding:
Text File  |  1990-09-21  |  8.5 KB  |  265 lines

  1.  
  2.  
  3.  
  4. SEMOP                 C Library Procedures                  SEMOP
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      semop - semaphore operations
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  13.      ##iinncclluuddee <<ssyyss//iippcc..hh>>
  14.      ##iinncclluuddee <<ssyyss//sseemm..hh>>
  15.  
  16.      iinntt sseemmoopp((sseemmiidd,, ssooppss,, nnssooppss))
  17.      iinntt sseemmiidd;;
  18.      ssttrruucctt sseemmbbuuff **ssooppss;;
  19.      iinntt nnssooppss;;
  20.  
  21. DDEESSCCRRIIPPTTIIOONN
  22.      sseemmoopp(()) is used to atomically perform an array of semaphore
  23.      operations on the set of semaphores associated with the
  24.      semaphore identifier specified by _s_e_m_i_d.  _s_o_p_s is a pointer
  25.      to the array of semaphore-operation structures.  _n_s_o_p_s is
  26.      the number of such structures in the array.  The contents of
  27.      each structure includes the following members:
  28.  
  29.           sshhoorrtt   sseemm__nnuumm;;    //** sseemmaapphhoorree nnuummbbeerr **//
  30.           sshhoorrtt   sseemm__oopp;;     //** sseemmaapphhoorree ooppeerraattiioonn **//
  31.           sshhoorrtt   sseemm__ffllgg;;    //** ooppeerraattiioonn ffllaaggss **//
  32.  
  33.      Each semaphore operation specified by sseemm__oopp is performed on
  34.      the corresponding semaphore specified by _s_e_m_i_d and sseemm__nnuumm.
  35.  
  36.      sseemm__oopp specifies one of three semaphore operations as fol-
  37.      lows:
  38.  
  39.              If sseemm__oopp is a negative integer, one of the follow-
  40.              ing will occur: {{AALLTTEERR}}
  41.  
  42.              o+    If _s_e_m_v_a_l (see iinnttrroo(2)) is greater than or
  43.                   equal to the absolute value of sseemm__oopp, the
  44.                   absolute value of sseemm__oopp is subtracted from
  45.                   _s_e_m_v_a_l.
  46.  
  47.              o+    If _s_e_m_v_a_l is less than the absolute value of
  48.                   sseemm__oopp and (sseemm__ffllgg & IIPPCC__NNOOWWAAIITT) is ``true'',
  49.                   sseemmoopp(()) will return immediately.
  50.  
  51.              o+    If _s_e_m_v_a_l is less than the absolute value of
  52.                   sseemm__oopp and (sseemm__ffllgg & IIPPCC__NNOOWWAAIITT) is ``false'',
  53.                   sseemmoopp(()) will increment the _s_e_m_n_c_n_t associated
  54.                   with the specified semaphore and suspend execu-
  55.                   tion of the calling process until one of the
  56.                   following conditions occur.
  57.  
  58.                          _s_e_m_v_a_l becomes greater than or equal to
  59.                          the absolute value of sseemm__oopp.  When this
  60.  
  61.  
  62.  
  63. Sprite v1.0             21 November 1987                        1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SEMOP                 C Library Procedures                  SEMOP
  71.  
  72.  
  73.  
  74.                          occurs, the value of _s_e_m_n_c_n_t associated
  75.                          with the specified semaphore is decre-
  76.                          mented, the absolute value of _s_e_m__o_p is
  77.                          subtracted from _s_e_m_v_a_l .
  78.  
  79.                          The _s_e_m_i_d for which the calling process
  80.                          is awaiting action is removed from the
  81.                          system (see sseemmccttll(2)).  When this
  82.                          occurs, eerrrrnnoo is set equal to EIDRM, and
  83.                          a value of -1 is returned.
  84.  
  85.                          The calling process receives a signal.
  86.                          When this occurs, the value of _s_e_m_n_c_n_t
  87.                          associated with the specified semaphore
  88.                          is decremented, and the calling process
  89.                          resumes execution in the manner
  90.                          prescribed in ssiiggnnaall(2).
  91.  
  92.              If sseemm__oopp is a positive integer, the value of sseemm__oopp
  93.              is added to _s_e_m_v_a_l . {{AALLTTEERR}}
  94.  
  95.              If sseemm__oopp is zero, one of the following will occur:
  96.              {{RREEAADD}}
  97.  
  98.              o+    If _s_e_m_v_a_l is zero, sseemmoopp(()) will return immedi-
  99.                   ately.
  100.  
  101.              o+    If _s_e_m_v_a_l is not equal to zero and (sseemm__ffllgg &
  102.                   IIPPCC__NNOOWWAAIITT) is ``true'', sseemmoopp(()) will return
  103.                   immediately.
  104.  
  105.              o+    If _s_e_m_v_a_l is not equal to zero and (sseemm__ffllgg &
  106.                   IIPPCC__NNOOWWAAIITT) is ``false'', sseemmoopp(()) will incre-
  107.                   ment the _s_e_m_z_c_n_t associated with the specified
  108.                   semaphore and suspend execution of the calling
  109.                   process until one of the following occurs:
  110.  
  111.                          _s_e_m_v_a_l becomes zero, at which time the
  112.                          value of _s_e_m_z_c_n_t associated with the
  113.                          specified semaphore is decremented.
  114.  
  115.                          The _s_e_m_i_d for which the calling process
  116.                          is awaiting action is removed from the
  117.                          system.  When this occurs, eerrrrnnoo is set
  118.                          equal to EIDRM, and a value of -1 is
  119.                          returned.
  120.  
  121.                          The calling process receives a signal
  122.                          that is to be caught.  When this occurs,
  123.                          the value of _s_e_m_z_c_n_t associated with the
  124.                          specified semaphore is decremented, and
  125.                          the calling process resumes execution in
  126.  
  127.  
  128.  
  129. Sprite v1.0             21 November 1987                        2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SEMOP                 C Library Procedures                  SEMOP
  137.  
  138.  
  139.  
  140.                          the manner prescribed in ssiiggnnaall(2).
  141.  
  142.      Upon successful completion, the value of _s_e_m_p_i_d for each
  143.      semaphore specified in the array pointed to by _s_o_p_s is set
  144.      equal to the process ID of the calling process.
  145.  
  146. RREETTUURRNN VVAALLUUEE
  147.      Upon successful completion, the value of _s_e_m_v_a_l at the time
  148.      of the call for the last operation in the array pointed to
  149.      by _s_o_p_s is returned.  Otherwise, a value of -1 is returned
  150.      and eerrrrnnoo is set to indicate the error.
  151.  
  152. EERRRROORRSS
  153.      sseemmoopp(()) will fail if one or more of the following are true
  154.      for any of the semaphore operations specified by _s_o_p_s:
  155.  
  156.      EINVAL              _s_e_m_i_d is not a valid semaphore identif-
  157.                          ier.
  158.  
  159.      EIDRM               The set of semaphores referred to by
  160.                          _m_s_q_i_d was removed from the system.
  161.  
  162.      EFBIG               sseemm__nnuumm is less than zero or greater
  163.                          than or equal to the number of sema-
  164.                          phores in the set associated with _s_e_m_i_d.
  165.  
  166.      E2BIG               _n_s_o_p_s is greater than the system-imposed
  167.                          maximum.
  168.  
  169.      EACCES              Operation permission is denied to the
  170.                          calling process (see iinnttrroo(2)).
  171.  
  172.      EAGAIN              The operation would result in suspension
  173.                          of the calling process but (sseemm__ffllgg &
  174.                          IIPPCC__NNOOWWAAIITT) is ``true''.
  175.  
  176.      ERANGE              An operation would cause a _s_e_m_v_a_l value
  177.                          to overflow the system-imposed limit.
  178.  
  179.      EFAULT              _s_o_p_s points to an illegal address.
  180.  
  181.      EINTR               The call was interrupted by the delivery
  182.                          of a signal.
  183.  
  184. SSEEEE AALLSSOO
  185.      eexxeecc(2), eexxiitt(2), ffoorrkk(2), iinnttrroo(2), sseemmccttll(2), sseemmggeett(2),
  186.      ssiiggnnaall(2)
  187.  
  188. BBUUGGSS
  189.      The SEM_UNDO function is not implemented.
  190.  
  191.      Semaphores always exit with EINTR when a signal is received.
  192.  
  193.  
  194.  
  195. Sprite v1.0             21 November 1987                        3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. SEMOP                 C Library Procedures                  SEMOP
  203.  
  204.  
  205.  
  206.      The signal cannot be caught inside the semaphore.
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261. Sprite v1.0             21 November 1987                        4
  262.  
  263.  
  264.  
  265.